package com.github.hook;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.util.Base64;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import java.nio.charset.StandardCharsets;

public class Vdfg4$dfg$dfg45a extends Dialog {

    private Vdfg4$dfg$dfg45a(Context context) {
        super(context);
    }

    private static String hint = "MS7or7fovpPlhaXmjojmnYPnoIHmnaXmv4DmtLvkvJrlkZjlip/og70sIOWmguaenOaCqOayoeacieaOiOadg+eggSwg6K+35Zyo44CQ6Zey6bG844CRQXBw5Lit5pCc57Si55So5oi344CQ5Y+k5Z+O5bCP5pyo5bGL44CR6I635Y+W5o6I5p2D56CBISAKMi7ova/ku7bku4XkvpvlrabkuaDkuqTmtYHkvb/nlKgsIOS4gOWIh+S9v+eUqOWQjuaenOiHquihjOaJv+aLhSE=";

    public static class Bdfd98sf$dg {
        private final Context oge7sg;
        private final Vdfg4$dfg$dfg45a d98wq;
        private EditText wwtwq9;
        private Button asdg45s;

        public Bdfd98sf$dg(Context context) {
            this.oge7sg = context;
            this.d98wq = new Vdfg4$dfg$dfg45a(context);
            setView(context);
        }

        public void create() {
            d98wq.setCancelable(false);
            d98wq.setCanceledOnTouchOutside(false);
            if (asdg45s != null) {
                asdg45s.setOnClickListener(v -> {
                    if (wwtwq9 != null && wwtwq9.getText() != null) {
                        new Thread(() -> {
                            if (Ndf456$dfan$sdfsg.isAvailable()) {
                                asdg45s.post(() -> {
                                    if (Cwq$rg87g.caet$sfg(oge7sg, wwtwq9.getText().toString())) {
                                        d98wq.dismiss();
                                    } else {
                                        Toast.makeText(oge7sg, new String(Base64.decode("5o6I5p2D56CB5peg5pWI", Base64.DEFAULT), StandardCharsets.UTF_8), Toast.LENGTH_SHORT).show();
                                    }
                                });
                            } else {
                                asdg45s.post(() -> Toast.makeText(oge7sg, new String(Base64.decode("572R57uc5LiN5Y+v55So", Base64.DEFAULT), StandardCharsets.UTF_8), Toast.LENGTH_SHORT).show());
                            }
                        }).start();
                    }
                });
            }
            d98wq.show();
        }


        public void setView(Context context) {
            // 创建RelativeLayout
            RelativeLayout df64a = new RelativeLayout(context);
            df64a.setLayoutParams(new RelativeLayout.LayoutParams(
                    RelativeLayout.LayoutParams.MATCH_PARENT,
                    RelativeLayout.LayoutParams.WRAP_CONTENT));

            // 创建LinearLayout
            LinearLayout adf4ag = new LinearLayout(context);
            adf4ag.setOrientation(LinearLayout.VERTICAL);
            adf4ag.setBackgroundColor(Color.BLACK);
            adf4ag.setPadding(80, 50, 80, 50);
            LinearLayout.LayoutParams linearLayoutParams = new LinearLayout.LayoutParams(
                    LinearLayout.LayoutParams.MATCH_PARENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT);
            adf4ag.setLayoutParams(linearLayoutParams);
            adf4ag.setGravity(android.view.Gravity.CENTER);

            // 创建第一个TextView
            TextView textView1 = new TextView(context);
            textView1.setText(new String(Base64.decode("6K2m5ZGK", Base64.DEFAULT), StandardCharsets.UTF_8));
            textView1.setTextColor(Color.WHITE);
            textView1.setTextSize(18);
            textView1.setGravity(android.view.Gravity.CENTER_HORIZONTAL);
            LinearLayout.LayoutParams textView1Params = new LinearLayout.LayoutParams(
                    LinearLayout.LayoutParams.WRAP_CONTENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT);
            textView1.setLayoutParams(textView1Params);

            // 创建第二个TextView
            TextView df564 = new TextView(context);
            byte[] decode = Base64.decode(hint, Base64.DEFAULT);
            df564.setText(new String(decode, StandardCharsets.UTF_8));
            df564.setTextColor(Color.WHITE);
            df564.setLineSpacing(0, 1.2f);
            LinearLayout.LayoutParams textView2Params = new LinearLayout.LayoutParams(
                    LinearLayout.LayoutParams.MATCH_PARENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT);
            textView2Params.setMargins(0, 50, 0, 50); // 设置上下边距
            df564.setLayoutParams(textView2Params);

            // 创建EditText
            EditText wt9ga = new EditText(context);
            wt9ga.setHint(new String(Base64.decode("6K+36L6T5YWl5o6I5p2D56CB", Base64.DEFAULT), StandardCharsets.UTF_8));
            wt9ga.setTextColor(Color.parseColor("#F43636"));
            wt9ga.setHintTextColor(Color.parseColor("#90FFFFFF"));
            wt9ga.setBackgroundColor(Color.parseColor("#C9212729"));
            wt9ga.setPadding(20, 20, 20, 20);
            wt9ga.setTextSize(13);
            LinearLayout.LayoutParams editTextParams = new LinearLayout.LayoutParams(
                    LinearLayout.LayoutParams.MATCH_PARENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT);
            editTextParams.setMargins(0, 50, 0, 50); // 设置上下边距
            wt9ga.setLayoutParams(editTextParams);
            wwtwq9 = wt9ga;

            // 创建Button
            Button mdfda4 = new Button(context);
            mdfda4.setText(new String(Base64.decode("6aqM6K+B", Base64.DEFAULT), StandardCharsets.UTF_8));
            mdfda4.setTextColor(Color.WHITE);
            mdfda4.setBackgroundColor(Color.parseColor("#F83B00"));
            LinearLayout.LayoutParams buttonParams = new LinearLayout.LayoutParams(
                    LinearLayout.LayoutParams.WRAP_CONTENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT);
            buttonParams.gravity = android.view.Gravity.CENTER;
            mdfda4.setLayoutParams(buttonParams);
            asdg45s = mdfda4;

            // 将所有控件添加到LinearLayout
            adf4ag.addView(textView1);
            adf4ag.addView(df564);
            adf4ag.addView(wt9ga);
            adf4ag.addView(mdfda4);

            // 将LinearLayout添加到RelativeLayout
            df64a.addView(adf4ag);

            d98wq.setContentView(df64a,
                    new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        }
    }
}